package org.fatmansoft.teach.repository;


import org.fatmansoft.teach.models.Honour;
import org.fatmansoft.teach.models.Student;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface HonourRepository extends JpaRepository<Honour,Integer> {


        @Query(value = "from Honour where person.num like %?1% or person.name like %?1% ",
            countQuery = "SELECT count(honourId) from Honour where ?1='' or person.num like %?1% or person.name like %?1% ")
        Page<Honour> findHonourPageByNumName(String numName, Pageable pageable);

        @Query(value = "from Honour where ?1='' or person.num like %?1% or person.name like %?1% ")
        List<Honour> findHonourListByNumName(String numName);
}